import http from "../request";
const apibase = "/api/Config";

//获取配置项
var getConfig = function (data) {
  return new Promise((resolve, reject) => {
    http
      .get(apibase + `/GetConfig?ConfigKey=${data}`)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//新增,修改配置项
var updConfig = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/UpdConfig`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//删除配置项
var delConfig = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/DelConfig`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

export { getConfig, updConfig, delConfig };
